package com.luoxiang.socialandroid.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

/**
 * @Description TODO
 * @systemUser Administrator
 * @Author LiangXin
 * @Date 08-20-2022 周六 16:47
 */
public class NavigationAdapter extends FragmentPagerAdapter {

    private List<Fragment> mFragments;
    private List<String> mtitle;


    public NavigationAdapter(FragmentManager supportFragmentManager, List<Fragment> mFragments) {
        super(supportFragmentManager);
        this.mFragments = mFragments;
        this.mtitle = mtitle;
    }


    @NonNull
    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Nullable
    @Override  //获取分页标题
    public CharSequence getPageTitle(int position) {
        return mtitle.get(position);
    }

}
